//
//  FLMManageOrderListCell.m
//  FLMSuperS
//
//  Created by xiaoyang on 16/9/16.
//  Copyright © 2016年 FaLaoMiaoNetworkTechnologyCo. All rights reserved.
//

#import "FLMManageOrderListCell.h"
#import "FLMTaoBaoOrderModel.h"
@interface FLMManageOrderListCell()

@property (nonatomic,strong) UILabel *orderNumberLb, *timeLb, *detailLb, *moneyLb;
@property (nonatomic,strong) UIImageView *stateView;

@end

@implementation FLMManageOrderListCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self layoutUI];
    }
    
    return self;
}

- (void)layoutUI
{
    
    if (!_stateView) {
        _stateView = [[UIImageView alloc]init];
        [self.contentView addSubview:_stateView];
        [_stateView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.bottom.mas_equalTo(0);
            make.size.mas_equalTo(CGSizeMake(70, 70));
        }];
    }

    
    if (!_orderNumberLb) {
        _orderNumberLb = [[UILabel alloc]init];
        _orderNumberLb.textColor = black;
        _orderNumberLb.font = font14;
        [self.contentView addSubview:_orderNumberLb];
        [_orderNumberLb mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(@15);
            make.top.mas_equalTo(@10);
        }];
    }
    
    if (!_timeLb) {
        _timeLb = [[UILabel alloc]init];
        _timeLb.textColor = black;
        _timeLb.font = font14;
        [self.contentView addSubview:_timeLb];
        [_timeLb mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(_orderNumberLb.mas_top);
            make.right.mas_equalTo(@-45);
        }];
    }
    if (!_detailLb) {
        _detailLb = [[UILabel alloc]init];
        _detailLb.textColor = black;
        _detailLb.font = font14;
        [self.contentView addSubview:_detailLb];
        [_detailLb mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(_orderNumberLb.mas_left);
            make.top.mas_equalTo(_orderNumberLb.mas_bottom).offset(8);
            make.right.mas_equalTo(@-20);
        }];
    }
    if (!_moneyLb) {
        _moneyLb = [[UILabel alloc]init];
        _moneyLb.textColor = orange;
        _moneyLb.font = font14;
        [self.contentView addSubview:_moneyLb];
        [_moneyLb mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(_orderNumberLb.mas_left);
            make.top.mas_equalTo(_detailLb.mas_bottom).offset(8);
        }];
    }

    
    
}

- (void)configCellWithModel:(FLMOrdersModel *)model
{
    _orderNumberLb.text = [NSString stringWithFormat:@"订单号：%@",model.order_id];
    _timeLb.text = model.porder_time;
    _detailLb.text = model.title;
    _moneyLb.text = model.pay;
    [_stateView sd_setImageWithURL:[NSURL URLWithString:model.pict_url] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    
    //    _stateView.image = [UIImage imageNamed:@"order_creat"];
}

@end
